use "ckr_lsq_2016.dta"

* Table 1 -- Grants *
xtreg lnpcgrants senprespartylastyear  years1-years25 if year > 1983, fe cluster(fips_state)
outreg2  using table1, word label dec(3) drop(years1-years25) replace
xtreg lnpcgrants senprespartylastyear senmajoritylastyear sendemsnewlastyear pctcopartisanhouselastyear  appropslastyear budgetlastyear financelastyear chairlastyear leaderlastyear freshmanlastyear senatorupforreelectionlastyear senchallengerqualitylastyear  years1-years25 if year > 1983, fe cluster(fips_state)
outreg2  using table1, word label dec(3) drop(years1-years25) append

* Table 2 -- Dynes and Huber Check *
xtreg lnpcgrants senprespartylastyear senmajoritylastyear sendemsnewlastyear pctcopartisanhouselastyear  appropslastyear budgetlastyear financelastyear chairlastyear leaderlastyear freshmanlastyear senatorupforreelectionlastyear senchallengerqualitylastyear stateinclastel  years1-years25 if year > 1983, fe cluster(fips_state)
outreg2  using table2, word label dec(3) drop(years1-years25) replace

* Table 3 -- Placebo test: Retirement and Disability *
xtreg lnpcretirementdisabled senprespartylastyear senmajoritylastyear sendemsnewlastyear pctcopartisanhouselastyear  appropslastyear budgetlastyear financelastyear chairlastyear leaderlastyear freshmanlastyear senatorupforreelectionlastyear senchallengerqualitylastyear  years1-years25 if year > 1983, fe cluster(fips_state)
outreg2  using table3, word label dec(3) drop(years1-years25) append
 
* Table 4 -- Do presidential co-partisans only reap gains when they are in the majority? *
xtreg lnpcgrants senprespartylastyear senprespartylastyearxsendg senmajoritylastyear sendemsnewlastyear pctcopartisanhouselastyear  appropslastyear budgetlastyear financelastyear chairlastyear leaderlastyear freshmanlastyear senatorupforreelectionlastyear senchallengerqualitylastyear  years1-years25 if year > 1983, fe cluster(fips_state)
outreg2  using table4, word label dec(3) drop(years1-years25) replace
* Note results look the same with state partisanship included *

* Table 5 -- Ex Post Influence *
xtreg lnpcgrants senprespartylastyear changeincopartisans senmajoritylastyear sendemsnewlastyear pctcopartisanhouselastyear  appropslastyear budgetlastyear financelastyear chairlastyear leaderlastyear freshmanlastyear senatorupforreelectionlastyear senchallengerqualitylastyear  years1-years25 if year > 1983 & yearafterelection == 1, fe cluster(fips_state)
outreg2  using table5, word label dec(3) drop(years1-years25) replace



